# 3 简单：无重复字符的最长子串
from collections import deque


def lengthOfLongestSubstring(s):
    ret = 0
    q = deque()
    for c in s:
        if c not in q:
            q.append(c)
            ret = max(ret, len(q))
        else:
            while c in q:
                q.popleft()
            q.append(c)
        print(len(q), ret)
    return ret


print(lengthOfLongestSubstring('aaadcdadsf'))
